import { defineStore } from 'pinia';

interface CartState {
  cartInit: number;
  cartNum: number;
  cartReload: number;
  buySelect: number[];
  delSelect: number[];
  [key: string]: any;
}

export const useCartStore = defineStore({
  id: 'cart',
  state: () =>
    <CartState>{
      cartInit: 0,
      cartNum: 0,
      cartReload: 0,
      buySelect: [],
      delSelect: [],
    },
  actions: {},
  unistorage: true, // 开启后采用localStorage对 state 的数据读写都将持久化
});
